import {
  Controller,
  Inject,
  Get,
  Query,
  Body,
  Post,
  Param,
  Del,
} from '@midwayjs/core';
import { WagesService } from '@service/jx3/wages.service';
import { ListWagesDTO } from '@dto/jx3/wages.dto';
import { BusinessType, Log } from '@decorator/log.decorator';

@Controller('/jx3/wages')
export class PostController {
  @Inject()
  WagesService: WagesService;

  // 获取列表
  @Get('/list')
  async list(@Query() queryParams: ListWagesDTO) {
    return await this.WagesService.list(queryParams);
  }

  // 新增
  @Log({ title: '工资配置新增', businessType: BusinessType.ADD })
  @Post('/add')
  async create(@Body() Wages: any) {
    return await this.WagesService.create(Wages);
  }

  // 删除
  @Log({ title: '工资配置删除', businessType: BusinessType.REMOVE })
  @Del('/:WagesId')
  async delete(@Param('WagesId') WagesId: string) {
    return await this.WagesService.delete(WagesId);
  }

  // 修改
  @Log({ title: '工资配置修改', businessType: BusinessType.EDIT })
  @Post('/update')
  async update(@Body() Wages: any) {
    return await this.WagesService.update(Wages);
  }
  // 获取工资配置详情
  @Get('/:WagesId')
  async get(@Param('WagesId') WagesId: string) {
    return await this.WagesService.detail(WagesId);
  }
  // 获取工资配置详情
  @Get('/getWagesDetail')
  async getWagesDetail() {
    return await this.WagesService.getWagesDetail();
  }
}
